/*
 * IPhisicsObject.h
 *
 *  Created on: 03.03.2012
 *      Author: Kirill Blinov
 *      Copyright: LGPL
 */

#ifndef IPHISICSOBJECT_H_
#define IPHISICSOBJECT_H_

#include <btBulletDynamicsCommon.h>
#include "glm/gtx/quaternion.hpp"

struct PHYSICS_OBJECT_BODY_PARAM
{
	float restitution;
	float friction;
	float linearDamping;
	float angularDamping;

	PHYSICS_OBJECT_BODY_PARAM() : restitution(0.01), friction(0.8),
			                      linearDamping(0.2), angularDamping(0.1)
	{}

	PHYSICS_OBJECT_BODY_PARAM( const float Restitution,
			                   const float Friction,
			                   const float LinearDamping,
			                   const float AngularDamping ) : restitution(Restitution), friction(Friction),
			                                                  linearDamping(LinearDamping), angularDamping(AngularDamping)
	{}
};

//-------------------------------//

class IPhysicsObject;

class PhysicObjectFabric
{
private:
	PhysicObjectFabric(){};
	~PhysicObjectFabric(){};
public:

   static IPhysicsObject* CreatePhysicsObject( const float Mass, glm::quat  Orientation, const glm::vec3 Position,
                                               const glm::vec3 Box[2], const glm::vec3 Inertia,
                                               const PHYSICS_OBJECT_BODY_PARAM &bodyParam );
   static IPhysicsObject* CreatePhysicsObject( const float Mass, glm::quat  Orientation, const glm::vec3 Position,
                                               const float ShereRadius, const glm::vec3 Inertia,
                                               const PHYSICS_OBJECT_BODY_PARAM &bodyParam )
   { return NULL; };

   static void DeletePhysicsObject( IPhysicsObject* Object );
};

//-------------------------------//

class IPhysicsObject
{
	friend class PhysicObjectFabric;
private:

protected:
	btCollisionObject* physicsObject;

protected:
	IPhysicsObject( btCollisionObject *PhysicsObject );
	virtual ~IPhysicsObject();

public:

	virtual btCollisionObject* GetBody(){ return physicsObject; }
};

//-------------------------------//

class CRigidConvexPhisicsObject : public IPhysicsObject
{
	friend class PhysicObjectFabric;
private:
	CRigidConvexPhisicsObject( btCollisionObject *PhysicsObject ) : IPhysicsObject(PhysicsObject)
	{};

	virtual ~CRigidConvexPhisicsObject(){};

public:

};

#endif /* IPHISICSOBJECT_H_ */
